home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Audio / AC3 / AC3Dec / parse.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-06  |  15.4 KB  |  638 lines

  1. /* 
  2.  *    parse.c
  3.  *
  4.  *    Copyright (C) Aaron Holtzman - May 1999
  5.  *
  6.  *  This file is part of ac3dec, a free Dolby AC-3 stream decoder.
  7.  *    
  8.  *  ac3dec is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  ac3dec is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  *
  23.  */
  24.  
  25. #include <stdlib.h>
  26. #include <stdio.h>
  27. #include "ac3.h"
  28. #include "ac3_internal.h"
  29.  
  30.  
  31. #include "bitstream.h"
  32. #include "stats.h"
  33. #include "debug.h"
  34. #include "crc.h"
  35. #include "parse.h"
  36.  
  37. /* Misc LUT */
  38. static const uint_16 nfchans[8] = {2,1,2,3,3,4,4,5};
  39.  
  40. struct frmsize_s
  41. {
  42.     uint_16 bit_rate;
  43.     uint_16 frm_size[3];
  44. };
  45.  
  46. static const struct frmsize_s frmsizecod_tbl[64] = 
  47. {
  48.     { 32  ,{64   ,69   ,96   } },
  49.     { 32  ,{64   ,70   ,96   } },
  50.     { 40  ,{80   ,87   ,120  } },
  51.     { 40  ,{80   ,88   ,120  } },
  52.     { 48  ,{96   ,104  ,144  } },
  53.     { 48  ,{96   ,105  ,144  } },
  54.     { 56  ,{112  ,121  ,168  } },
  55.     { 56  ,{112  ,122  ,168  } },
  56.     { 64  ,{128  ,139  ,192  } },
  57.     { 64  ,{128  ,140  ,192  } },
  58.     { 80  ,{160  ,174  ,240  } },
  59.     { 80  ,{160  ,175  ,240  } },
  60.     { 96  ,{192  ,208  ,288  } },
  61.     { 96  ,{192  ,209  ,288  } },
  62.     { 112 ,{224  ,243  ,336  } },
  63.     { 112 ,{224  ,244  ,336  } },
  64.     { 128 ,{256  ,278  ,384  } },
  65.     { 128 ,{256  ,279  ,384  } },
  66.     { 160 ,{320  ,348  ,480  } },
  67.     { 160 ,{320  ,349  ,480  } },
  68.     { 192 ,{384  ,417  ,576  } },
  69.     { 192 ,{384  ,418  ,576  } },
  70.     { 224 ,{448  ,487  ,672  } },
  71.     { 224 ,{448  ,488  ,672  } },
  72.     { 256 ,{512  ,557  ,768  } },
  73.     { 256 ,{512  ,558  ,768  } },
  74.     { 320 ,{640  ,696  ,960  } },
  75.     { 320 ,{640  ,697  ,960  } },
  76.     { 384 ,{768  ,835  ,1152 } },
  77.     { 384 ,{768  ,836  ,1152 } },
  78.     { 448 ,{896  ,975  ,1344 } },
  79.     { 448 ,{896  ,976  ,1344 } },
  80.     { 512 ,{1024 ,1114 ,1536 } },
  81.     { 512 ,{1024 ,1115 ,1536 } },
  82.     { 576 ,{1152 ,1253 ,1728 } },
  83.     { 576 ,{1152 ,1254 ,1728 } },
  84.     { 640 ,{1280 ,1393 ,1920 } },
  85.     { 640 ,{1280 ,1394 ,1920 } }
  86. };
  87.  
  88. /* Parse a syncinfo structure, minus the sync word */
  89. void
  90. parse_syncinfo(syncinfo_t *syncinfo)
  91. {
  92.     uint_32 tmp = 0;
  93.     uint_16 sync_word = 0;
  94.     uint_32 time_out = 1<<16;
  95.  
  96.     // 
  97.     // Find a ac3 sync frame. Time out if we read 64k without finding
  98.     // one.
  99.     // 
  100.     while(time_out--)
  101.     {
  102.         sync_word = (sync_word << 8) + bitstream_get_byte();
  103.  
  104.         if(sync_word == 0x0b77)
  105.             break;
  106.     }
  107.  
  108.     //
  109.     // We need to read in the entire syncinfo struct (0x0b77 + 24 bits)
  110.     // in order to determine how big the frame is
  111.     //
  112.     tmp = (tmp << 8) + bitstream_get_byte();
  113.     tmp = (tmp << 8) + bitstream_get_byte();
  114.     tmp = (tmp << 8) + bitstream_get_byte();
  115.  
  116.     // Get the sampling rate 
  117.     syncinfo->fscod  = (tmp >> 6) & 0x3;
  118.  
  119.     if(syncinfo->fscod == 3)
  120.     {
  121.         //invalid sampling rate code
  122.         error_flag = 1;    
  123.         return;
  124.     }
  125.     else if(syncinfo->fscod == 2)
  126.         syncinfo->sampling_rate = 32000;
  127.     else if(syncinfo->fscod == 1)
  128.         syncinfo->sampling_rate = 44100;
  129.     else
  130.         syncinfo->sampling_rate = 48000;
  131.  
  132.     // Get the frame size code 
  133.     syncinfo->frmsizecod = tmp & 0x3f;
  134.  
  135.     // Calculate the frame size and bitrate
  136.     syncinfo->frame_size = 
  137.         frmsizecod_tbl[syncinfo->frmsizecod].frm_size[syncinfo->fscod];
  138.     syncinfo->bit_rate = frmsizecod_tbl[syncinfo->frmsizecod].bit_rate;
  139.  
  140.  
  141.     // Buffer the entire syncframe 
  142.     bitstream_buffer_frame(syncinfo->frame_size * 2 - 5);
  143.  
  144.     // Check the crc over the entire frame 
  145.     crc_init();
  146.  
  147.     crc_process_byte(tmp>>16);
  148.     crc_process_byte((tmp>>8) & 0xff);
  149.     crc_process_byte(tmp & 0xff);
  150.     crc_process_frame(bitstream_get_buffer_start(),syncinfo->frame_size * 2 - 5);
  151.  
  152.     if(!crc_validate())
  153.     {
  154.         error_flag = 1;
  155.         fprintf(stderr,"** CRC failed - skipping frame **\n");
  156.         return;
  157.     }
  158.  
  159.     stats_print_syncinfo(syncinfo);
  160. }
  161.  
  162. /*
  163.  * This routine fills a bsi struct from the AC3 stream
  164.  */
  165.  
  166. void
  167. parse_bsi(bsi_t *bsi)
  168. {
  169.     uint_32 i;
  170.  
  171.     /* Check the AC-3 version number */
  172.     bsi->bsid = bitstream_get(5);
  173.  
  174.     /* Get the audio service provided by the steram */
  175.     bsi->bsmod = bitstream_get(3);
  176.  
  177.     /* Get the audio coding mode (ie how many channels)*/
  178.     bsi->acmod = bitstream_get(3);
  179.     /* Predecode the number of full bandwidth channels as we use this
  180.      * number a lot */
  181.     bsi->nfchans = nfchans[bsi->acmod];
  182.  
  183.     /* If it is in use, get the centre channel mix level */
  184.     if ((bsi->acmod & 0x1) && (bsi->acmod != 0x1))
  185.         bsi->cmixlev = bitstream_get(2);
  186.  
  187.     /* If it is in use, get the surround channel mix level */
  188.     if (bsi->acmod & 0x4)
  189.         bsi->surmixlev = bitstream_get(2);
  190.  
  191.     /* Get the dolby surround mode if in 2/0 mode */
  192.     if(bsi->acmod == 0x2)
  193.         bsi->dsurmod= bitstream_get(2);
  194.  
  195.     /* Is the low frequency effects channel on? */
  196.     bsi->lfeon = bitstream_get(1);
  197.  
  198.     /* Get the dialogue normalization level */
  199.     bsi->dialnorm = bitstream_get(5);
  200.  
  201.     /* Does compression gain exist? */
  202.     bsi->compre = bitstream_get(1);
  203.     if (bsi->compre)
  204.     {
  205.         /* Get compression gain */
  206.         bsi->compr = bitstream_get(8);
  207.     }
  208.  
  209.     /* Does language code exist? */
  210.     bsi->langcode = bitstream_get(1);
  211.     if (bsi->langcode)
  212.     {
  213.         /* Get langauge code */
  214.         bsi->langcod = bitstream_get(8);
  215.     }
  216.  
  217.     /* Does audio production info exist? */
  218.     bsi->audprodie = bitstream_get(1);
  219.     if (bsi->audprodie)
  220.     {
  221.         /* Get mix level */
  222.         bsi->mixlevel = bitstream_get(5);
  223.  
  224.         /* Get room type */
  225.         bsi->roomtyp = bitstream_get(2);
  226.     }
  227.  
  228.     /* If we're in dual mono mode then get some extra info */
  229.     if (bsi->acmod ==0)
  230.     {
  231.         /* Get the dialogue normalization level two */
  232.         bsi->dialnorm2 = bitstream_get(5);
  233.  
  234.         /* Does compression gain two exist? */
  235.         bsi->compr2e = bitstream_get(1);
  236.         if (bsi->compr2e)
  237.         {
  238.             /* Get compression gain two */
  239.             bsi->compr2 = bitstream_get(8);
  240.         }
  241.  
  242.         /* Does language code two exist? */
  243.         bsi->langcod2e = bitstream_get(1);
  244.         if (bsi->langcod2e)
  245.         {
  246.             /* Get langauge code two */
  247.             bsi->langcod2 = bitstream_get(8);
  248.         }
  249.  
  250.         /* Does audio production info two exist? */
  251.         bsi->audprodi2e = bitstream_get(1);
  252.         if (bsi->audprodi2e)
  253.         {
  254.             /* Get mix level two */
  255.             bsi->mixlevel2 = bitstream_get(5);
  256.  
  257.             /* Get room type two */
  258.             bsi->roomtyp2 = bitstream_get(2);
  259.         }
  260.     }
  261.  
  262.     /* Get the copyright bit */
  263.     bsi->copyrightb = bitstream_get(1);
  264.  
  265.     /* Get the original bit */
  266.     bsi->origbs = bitstream_get(1);
  267.     
  268.     /* Does timecode one exist? */
  269.     bsi->timecod1e = bitstream_get(1);
  270.  
  271.     if(bsi->timecod1e)
  272.         bsi->timecod1 = bitstream_get(14);
  273.  
  274.     /* Does timecode two exist? */
  275.     bsi->timecod2e = bitstream_get(1);
  276.  
  277.     if(bsi->timecod2e)
  278.         bsi->timecod2 = bitstream_get(14);
  279.  
  280.     /* Does addition info exist? */
  281.     bsi->addbsie = bitstream_get(1);
  282.  
  283.     if(bsi->addbsie)
  284.     {
  285.         /* Get how much info is there */
  286.         bsi->addbsil = bitstream_get(6);
  287.  
  288.         /* Get the additional info */
  289.         for(i=0;i<(bsi->addbsil + 1);i++)
  290.             bsi->addbsi[i] = bitstream_get(8);
  291.     }
  292.  
  293.     stats_print_bsi(bsi);
  294. }
  295.  
  296. /* More pain inducing parsing */
  297. void
  298. parse_audblk(bsi_t *bsi,audblk_t *audblk)
  299. {
  300.     int i,j;
  301.  
  302.     for (i=0;i < bsi->nfchans; i++)
  303.     {
  304.         /* Is this channel an interleaved 256 + 256 block ? */
  305.         audblk->blksw[i] = bitstream_get(1);
  306.     }
  307.  
  308.     for (i=0;i < bsi->nfchans; i++)
  309.     {
  310.         /* Should we dither this channel? */
  311.         audblk->dithflag[i] = bitstream_get(1);
  312.     }
  313.  
  314.     /* Does dynamic range control exist? */
  315.     audblk->dynrnge = bitstream_get(1);
  316.     if (audblk->dynrnge)
  317.     {
  318.         /* Get dynamic range info */
  319.         audblk->dynrng = bitstream_get(8);
  320.     }
  321.  
  322.     /* If we're in dual mono mode then get the second channel DR info */
  323.     if (bsi->acmod == 0)
  324.     {
  325.         /* Does dynamic range control two exist? */
  326.         audblk->dynrng2e = bitstream_get(1);
  327.         if (audblk->dynrng2e)
  328.         {
  329.             /* Get dynamic range info */
  330.             audblk->dynrng2 = bitstream_get(8);
  331.         }
  332.     }
  333.  
  334.     /* Does coupling strategy exist? */
  335.     audblk->cplstre = bitstream_get(1);
  336.     if (audblk->cplstre)
  337.     {
  338.         /* Is coupling turned on? */
  339.         audblk->cplinu = bitstream_get(1);
  340.         if(audblk->cplinu)
  341.         {
  342.             for(i=0;i < bsi->nfchans; i++)
  343.                 audblk->chincpl[i] = bitstream_get(1);
  344.             if(bsi->acmod == 0x2)
  345.                 audblk->phsflginu = bitstream_get(1);
  346.             audblk->cplbegf = bitstream_get(4);
  347.             audblk->cplendf = bitstream_get(4);
  348.             audblk->ncplsubnd = (audblk->cplendf + 2) - audblk->cplbegf + 1;
  349.  
  350.             /* Calculate the start and end bins of the coupling channel */
  351.             audblk->cplstrtmant = (audblk->cplbegf * 12) + 37 ; 
  352.             audblk->cplendmant =  ((audblk->cplendf + 3) * 12) + 37;
  353.  
  354.             /* The number of combined subbands is ncplsubnd minus each combined
  355.              * band */
  356.             audblk->ncplbnd = audblk->ncplsubnd; 
  357.  
  358.             for(i=1; i< audblk->ncplsubnd; i++)
  359.             {
  360.                 audblk->cplbndstrc[i] = bitstream_get(1);
  361.                 audblk->ncplbnd -= audblk->cplbndstrc[i];
  362.             }
  363.         }
  364.     }
  365.  
  366.     if(audblk->cplinu)
  367.     {
  368.         /* Loop through all the channels and get their coupling co-ords */    
  369.         for(i=0;i < bsi->nfchans;i++)
  370.         {
  371.             if(!audblk->chincpl[i])
  372.                 continue;
  373.  
  374.             /* Is there new coupling co-ordinate info? */
  375.             audblk->cplcoe[i] = bitstream_get(1);
  376.  
  377.             if(audblk->cplcoe[i])
  378.             {
  379.                 audblk->mstrcplco[i] = bitstream_get(2); 
  380.                 for(j=0;j < audblk->ncplbnd; j++)
  381.                 {
  382.                     audblk->cplcoexp[i][j] = bitstream_get(4); 
  383.                     audblk->cplcomant[i][j] = bitstream_get(4); 
  384.                 }
  385.             }
  386.         }
  387.  
  388.         /* If we're in dual mono mode, there's going to be some phase info */
  389.         if( (bsi->acmod == 0x2) && audblk->phsflginu && 
  390.                 (audblk->cplcoe[0] || audblk->cplcoe[1]))
  391.         {
  392.             for(j=0;j < audblk->ncplbnd; j++)
  393.                 audblk->phsflg[j] = bitstream_get(1); 
  394.  
  395.         }
  396.     }
  397.  
  398.     /* If we're in dual mono mode, there may be a rematrix strategy */
  399.     if(bsi->acmod == 0x2)
  400.     {
  401.         audblk->rematstr = bitstream_get(1);
  402.         if(audblk->rematstr)
  403.         {
  404.             if (audblk->cplinu == 0) 
  405.             { 
  406.                 for(i = 0; i < 4; i++) 
  407.                     audblk->rematflg[i] = bitstream_get(1);
  408.             }
  409.             if((audblk->cplbegf > 2) && audblk->cplinu) 
  410.             {
  411.                 for(i = 0; i < 4; i++) 
  412.                     audblk->rematflg[i] = bitstream_get(1);
  413.             }
  414.             if((audblk->cplbegf <= 2) && audblk->cplinu) 
  415.             { 
  416.                 for(i = 0; i < 3; i++) 
  417.                     audblk->rematflg[i] = bitstream_get(1);
  418.             } 
  419.             if((audblk->cplbegf == 0) && audblk->cplinu) 
  420.                 for(i = 0; i < 2; i++) 
  421.                     audblk->rematflg[i] = bitstream_get(1);
  422.  
  423.         }
  424.     }
  425.  
  426.     if (audblk->cplinu)
  427.     {
  428.         /* Get the coupling channel exponent strategy */
  429.         audblk->cplexpstr = bitstream_get(2);
  430.         audblk->ncplgrps = (audblk->cplendmant - audblk->cplstrtmant) / 
  431.                 (3 << (audblk->cplexpstr-1));
  432.     }
  433.  
  434.     for(i = 0; i < bsi->nfchans; i++)
  435.         audblk->chexpstr[i] = bitstream_get(2);
  436.  
  437.     /* Get the exponent strategy for lfe channel */
  438.     if(bsi->lfeon) 
  439.         audblk->lfeexpstr = bitstream_get(1);
  440.  
  441.     /* Determine the bandwidths of all the fbw channels */
  442.     for(i = 0; i < bsi->nfchans; i++) 
  443.     { 
  444.         uint_16 grp_size;
  445.  
  446.         if(audblk->chexpstr[i] != EXP_REUSE) 
  447.         { 
  448.             if (audblk->cplinu && audblk->chincpl[i]) 
  449.             {
  450.                 audblk->endmant[i] = audblk->cplstrtmant;
  451.             }
  452.             else
  453.             {
  454.                 audblk->chbwcod[i] = bitstream_get(6); 
  455.                 audblk->endmant[i] = ((audblk->chbwcod[i] + 12) * 3) + 37;
  456.             }
  457.  
  458.             /* Calculate the number of exponent groups to fetch */
  459.             grp_size =  3 * (1 << (audblk->chexpstr[i] - 1));
  460.             audblk->nchgrps[i] = (audblk->endmant[i] - 1 + (grp_size - 3)) / grp_size;
  461.         }
  462.     }
  463.  
  464.     /* Get the coupling exponents if they exist */
  465.     if(audblk->cplinu && (audblk->cplexpstr != EXP_REUSE))
  466.     {
  467.         audblk->cplabsexp = bitstream_get(4);
  468.         for(i=0;i< audblk->ncplgrps;i++)
  469.             audblk->cplexps[i] = bitstream_get(7);
  470.     }
  471.  
  472.     /* Get the fwb channel exponents */
  473.     for(i=0;i < bsi->nfchans; i++)
  474.     {
  475.         if(audblk->chexpstr[i] != EXP_REUSE)
  476.         {
  477.             audblk->exps[i][0] = bitstream_get(4);            
  478.             for(j=1;j<=audblk->nchgrps[i];j++)
  479.                 audblk->exps[i][j] = bitstream_get(7);
  480.             audblk->gainrng[i] = bitstream_get(2);
  481.         }
  482.     }
  483.  
  484.     /* Get the lfe channel exponents */
  485.     if(bsi->lfeon && (audblk->lfeexpstr != EXP_REUSE))
  486.     {
  487.         audblk->lfeexps[0] = bitstream_get(4);
  488.         audblk->lfeexps[1] = bitstream_get(7);
  489.         audblk->lfeexps[2] = bitstream_get(7);
  490.     }
  491.  
  492.     /* Get the parametric bit allocation parameters */
  493.     audblk->baie = bitstream_get(1);
  494.  
  495.     if(audblk->baie)
  496.     {
  497.         audblk->sdcycod = bitstream_get(2);
  498.         audblk->fdcycod = bitstream_get(2);
  499.         audblk->sgaincod = bitstream_get(2);
  500.         audblk->dbpbcod = bitstream_get(2);
  501.         audblk->floorcod = bitstream_get(3);
  502.     }
  503.  
  504.     /* Get the SNR off set info if it exists */
  505.     audblk->snroffste = bitstream_get(1);
  506.  
  507.     if(audblk->snroffste)
  508.     {
  509.         audblk->csnroffst = bitstream_get(6);
  510.  
  511.         if(audblk->cplinu)
  512.         {
  513.             audblk->cplfsnroffst = bitstream_get(4);
  514.             audblk->cplfgaincod = bitstream_get(3);
  515.         }
  516.  
  517.         for(i = 0;i < bsi->nfchans; i++)
  518.         {
  519.             audblk->fsnroffst[i] = bitstream_get(4);
  520.             audblk->fgaincod[i] = bitstream_get(3);
  521.         }
  522.         if(bsi->lfeon)
  523.         {
  524.  
  525.             audblk->lfefsnroffst = bitstream_get(4);
  526.             audblk->lfefgaincod = bitstream_get(3);
  527.         }
  528.     }
  529.  
  530.     /* Get coupling leakage info if it exists */
  531.     if(audblk->cplinu)
  532.     {
  533.         audblk->cplleake = bitstream_get(1);    
  534.         
  535.         if(audblk->cplleake)
  536.         {
  537.             audblk->cplfleak = bitstream_get(3);
  538.             audblk->cplsleak = bitstream_get(3);
  539.         }
  540.     }
  541.     
  542.     /* Get the delta bit alloaction info */
  543.     audblk->deltbaie = bitstream_get(1);    
  544.     
  545.     if(audblk->deltbaie)
  546.     {
  547.         if(audblk->cplinu)
  548.             audblk->cpldeltbae = bitstream_get(2);
  549.  
  550.         for(i = 0;i < bsi->nfchans; i++)
  551.             audblk->deltbae[i] = bitstream_get(2);
  552.  
  553.         if (audblk->cplinu && (audblk->cpldeltbae == DELTA_BIT_NEW))
  554.         {
  555.             audblk->cpldeltnseg = bitstream_get(3);
  556.             for(i = 0;i < audblk->cpldeltnseg + 1; i++)
  557.             {
  558.                 audblk->cpldeltoffst[i] = bitstream_get(5);
  559.                 audblk->cpldeltlen[i] = bitstream_get(4);
  560.                 audblk->cpldeltba[i] = bitstream_get(3);
  561.             }
  562.         }
  563.  
  564.         for(i = 0;i < bsi->nfchans; i++)
  565.         {
  566.             if (audblk->deltbae[i] == DELTA_BIT_NEW)
  567.             {
  568.                 audblk->deltnseg[i] = bitstream_get(3);
  569.                 for(j = 0; j < audblk->deltnseg[i] + 1; j++)
  570.                 {
  571.                     audblk->deltoffst[i][j] = bitstream_get(5);
  572.                     audblk->deltlen[i][j] = bitstream_get(4);
  573.                     audblk->deltba[i][j] = bitstream_get(3);
  574.                 }
  575.             }
  576.         }
  577.     }
  578.  
  579.     /* Check to see if there's any dummy info to get */
  580.     if((audblk->skiple =  bitstream_get(1)))
  581.     {
  582.         uint_16 skip_data;
  583.  
  584.         audblk->skipl = bitstream_get(9);
  585.         //XXX remove
  586.         //fprintf(stderr,"(parse) skipping %d bytes\n",audblk->skipl);
  587.  
  588.         for(i = 0; i < audblk->skipl ; i++)
  589.         {
  590.             skip_data = bitstream_get(8);
  591.             //XXX remove
  592.             //fprintf(stderr,"skipped data %2x\n",skip_data);
  593.             //if(skip_data != 0)
  594.             //{    
  595.                 //dprintf("(parse) Invalid skipped data %2x\n",skip_data);
  596.                 //exit(1);
  597.             //}
  598.         }
  599.     }
  600.  
  601.     stats_print_audblk(bsi,audblk);
  602. }
  603.  
  604. void
  605. parse_auxdata(syncinfo_t *syncinfo)
  606. {
  607.     //FIXME keep this now that we don't really need it?
  608. #if 0
  609.     int i;
  610.     int skip_length;
  611.     uint_16 crc;
  612.     uint_16 auxdatae;
  613.  
  614.     skip_length = (syncinfo->frame_size * 16)  - bitstream_get_total_bits() - 17 - 1;
  615.  
  616.     //XXX remove
  617.     //dprintf("(auxdata) skipping %d auxbits\n",skip_length);
  618.     
  619.     for(i=0; i <  skip_length; i++)
  620.         //printf("Skipped bit %i\n",(uint_16)bitstream_get(1));
  621.         bitstream_get(1);
  622.  
  623.     //get the auxdata exists bit
  624.     auxdatae = bitstream_get(1);    
  625.  
  626.     //XXX remove
  627.     //dprintf("auxdatae = %i\n",auxdatae);
  628.  
  629.     //Skip the CRC reserved bit
  630.     bitstream_get(1);
  631.  
  632.     //Get the crc
  633.     crc = bitstream_get(16);
  634. #endif
  635. }
  636.  
  637.  
  638.